package com.ruoyi.system.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 地理位置服务配置属性
 * 
 * @author ruoyi
 */
@Component
@ConfigurationProperties(prefix = "geo")
public class GeoProperties 
{
    /** 地图服务提供商: amap(高德) 或 tencent(腾讯) */
    private String provider = "tencent";
    
    /** 高德地图配置 */
    private AmapConfig amap = new AmapConfig();
    
    /** 腾讯地图配置 */
    private TencentConfig tencent = new TencentConfig();
    
    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public AmapConfig getAmap() {
        return amap;
    }

    public void setAmap(AmapConfig amap) {
        this.amap = amap;
    }

    public TencentConfig getTencent() {
        return tencent;
    }

    public void setTencent(TencentConfig tencent) {
        this.tencent = tencent;
    }

    /** 高德地图配置 */
    public static class AmapConfig {
        /** 高德地图API Key */
        private String key;
        
        /** 地理编码API地址 */
        private String url = "https://restapi.amap.com/v3/geocode/geo";
        
        /** 逆地理编码配置 */
        private Regeo regeo = new Regeo();

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public Regeo getRegeo() {
            return regeo;
        }

        public void setRegeo(Regeo regeo) {
            this.regeo = regeo;
        }
    }

    /** 腾讯地图配置 */
    public static class TencentConfig {
        /** 腾讯地图API Key */
        private String key;
        
        /** 地理编码API地址 */
        private String url = "https://apis.map.qq.com/ws/geocoder/v1/";
        
        /** 逆地理编码配置 */
        private Regeo regeo = new Regeo();

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public Regeo getRegeo() {
            return regeo;
        }

        public void setRegeo(Regeo regeo) {
            this.regeo = regeo;
        }
    }

    /** 逆地理编码配置 */
    public static class Regeo {
        /** 逆地理编码API地址 */
        private String url;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }
}
